"use strict";

// const { city_name } = require("../../../public/config/config");

// console.log("process.env.NODE_ENV: ", process.env.NODE_ENV);
if (!Array.prototype.indexOf) {
  Array.prototype.indexOf = function (elt) {
    var len = this.length >>> 0;
    var from = Number(arguments[1]) || 0;
    from = from < 0 ? Math.ceil(from) : Math.floor(from);
    if (from < 0) from += len;
    for (; from < len; from++) {
      if (from in this && this[from] === elt) return from;
    }
    return -1;
  };
}
var baseUrl = "/wycms-api";
var zhibanDetail = {};
function handleResponse(res) {
  zhibanDetail = res.data;
  console.log("zhibanDetail: ", zhibanDetail);
  var s = "";
  if (["dt", "sz"].indexOf(city_name) > -1) {
    s += "<span>";
    s += "<p class=\"title\">值班提示</p>\n      <p class=\"desc\">\n        <span class=\"left\">带班领导：</span>\n        <span class=\"right\">\n\n          <span class=\"leader1\"> ".concat(zhibanDetail.leader1, " </span>&nbsp;&nbsp;\n\n          ");
    if (zhibanDetail.leader2) {
      s += "<span class=\"leader2\"> ".concat(zhibanDetail.leader2, "</span>");
    }
    s += " </span></p>";
    if (["sz"].indexOf(city_name) > -1) {
      s += "<p class=\"desc\">\n        <span class=\"left\">备班人员：</span>\n        <span class=\"right\">\n          <span class=\"dutypeople1\">".concat(zhibanDetail.dutypeople1, "</span>&nbsp;&nbsp;\n      ");
      //  <span class="dutypeople2">${zhibanDetail.dutypeople2}</span>
      //   </span>
      // </p>
      // <p class="desc">
      //   <span class="left">值班人员：</span>
      //   <span class="right">
      //     <span class="weekdaypeople1">${zhibanDetail.weekdaypeople1}</span>&nbsp;&nbsp;
      //     <span class="weekdaypeople2">${zhibanDetail.weekdaypeople2}</span>
      //   </span>
      // </p>
      if (zhibanDetail.dutypeople2) {
        s += "\n        <span class=\"dutypeople2\">".concat(zhibanDetail.dutypeople2, "</span>\n        ");
      }
      s += "</span>\n      </p>\n      ";
    }
    s += "\n      <p class=\"desc\">\n        <span class=\"left\">值班人员：</span>\n        <span class=\"right\">\n          <span class=\"weekdaypeople1\">".concat(zhibanDetail.weekdaypeople1, "</span>&nbsp;&nbsp;");
    if (zhibanDetail.weekdaypeople2) {
      s += "<span class=\"weekdaypeople2\">".concat(zhibanDetail.weekdaypeople2, "</span>");
    }
    s += "</span>\n      </p>";
    s += "</span>";
  } else if (["yc"].indexOf(city_name) > -1) {
    s += "<span>\n      <marquee scrollamount=\"2\">\n        <span class=\"name\"> ".concat(zhibanDetail.dutypeople1, " </span>\n        <span class=\"phone\"> 电话：").concat(zhibanDetail.phone, " </span>\n        <span class=\"tel\"> 手机号：").concat(zhibanDetail.tel, " </span>\n      </marquee>\n    </span>  ");
  }
  $("#app").append(s);
}
function getZhiban(name) {
  var query = getQuery();
  console.log("query: ", query);
  if (["yc"].indexOf(city_name) > -1) {
    $.ajax({
      url: baseUrl + "/customize/duty/indexYcMini",
      method: "post",
      headers: {
        "content-type": "application/x-www-form-urlencoded"
      },
      xhrFields: {
        withCredentials: false
      },
      data: {
        siteId: query.siteId
      },
      success: handleResponse
    });
  } else {
    $.ajax({
      url: baseUrl + "/customize/duty/index",
      method: "post",
      headers: {
        "content-type": "application/x-www-form-urlencoded"
      },
      xhrFields: {
        withCredentials: false
      },
      data: {
        siteId: query.siteId
      },
      success: handleResponse
    });
  }
}
getZhiban();